x86 passthru:: graphics passthrough
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Sep 2009 10:36:16 +0000 (11:36 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 1 Sep 2009 10:36:16 +0000 (11:36 +0100)
This patch supports basic gfx passthrough on xen side:
  - add a VGA type for gfx passthrough, and get the size of VGA bios
  of passthrouged gfx in hvmloader
  - add a config option 'gfx_passthru' for gfx passthrough

Signed-off-by: Ben Lin <ben.y.lin@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
tools/firmware/hvmloader/hvmloader.c
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index c154eff952a020ec55b75d88faccad2cf2fc3f28..581bcafc522d3e48ae0331deec5ae551599c1261 100644 (file)
@@ -113,7 +113,7 @@ asm (
 unsigned long pci_mem_start = PCI_MEM_START;
 unsigned long pci_mem_end = PCI_MEM_END;
 
-static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none;
+static enum { VGA_none, VGA_std, VGA_cirrus, VGA_pt } virtual_vga = VGA_none;
 
 static void init_hypercalls(void)
 {
@@ -212,8 +212,10 @@ static void pci_setup(void)
         case 0x0300:
             if ( (vendor_id == 0x1234) && (device_id == 0x1111) )
                 virtual_vga = VGA_std;
-            if ( (vendor_id == 0x1013) && (device_id == 0xb8) )
+            else if ( (vendor_id == 0x1013) && (device_id == 0xb8) )
                 virtual_vga = VGA_cirrus;
+            else
+                virtual_vga = VGA_pt;
             break;
         case 0x0680:
             /* PIIX4 ACPI PM. Special device with special PCI config space. */
@@ -685,6 +687,11 @@ int main(void)
                vgabios_stdvga, sizeof(vgabios_stdvga));
         vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
         break;
+    case VGA_pt:
+        printf("Loading VGABIOS of passthroughed gfx ...\n");
+        vgabios_sz =
+            round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+        break;
     default:
         printf("No emulated VGA adaptor ...\n");
         break;
index 6f39e7ed1abe22f93bb18116699c22f1ec1a2271..06291a2ecf3bd34e2bfe6f3708526d367c001104 100644 (file)
@@ -175,6 +175,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'pci_msitranslate': int,
     'pci_power_mgmt': int,
     'xen_platform_pci': int,
+    "gfx_passthru": int,
 }
 
 # Xen API console 'other_config' keys.
index 0e9abd97261fcfa8d4867d67d3f0fac7d25c9ef9..5d1a0f4dffd2065dfb5a4639ab727bdddbffff5f 100644 (file)
@@ -807,7 +807,7 @@ class HVMImageHandler(ImageHandler):
 
         dmargs = [ 'boot', 'fda', 'fdb', 'soundhw',
                    'localtime', 'serial', 'stdvga', 'isa',
-                   'acpi', 'usb', 'usbdevice' ]
+                   'acpi', 'usb', 'usbdevice', 'gfx_passthru' ]
 
         for a in dmargs:
             v = vmConfig['platform'].get(a)
index 92ab12b0faf1541c71a2d097c5d7000ebf2a178c..d7ed07b3c6320d369607c90dbf4495ec07ae647b 100644 (file)
@@ -547,6 +547,10 @@ gopts.var('sdl', val='',
           fn=set_value, default=None,
           use="""Should the device model use SDL?""")
 
+gopts.var('gfx_passthru', val='',
+          fn=set_value, default=None,
+          use="""Passthrough graphics card?""")
+
 gopts.var('opengl', val='',
           fn=set_value, default=None,
           use="""Enable\Disable OpenGL""")
@@ -957,7 +961,8 @@ def configure_hvm(config_image, vals):
              'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
              'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
              'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate',
-             'vpt_align', 'pci_power_mgmt', 'xen_platform_pci' ]
+             'vpt_align', 'pci_power_mgmt', 'xen_platform_pci',
+             'gfx_passthru' ]
 
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None: